package com.simple.ds.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.simple.common.entity.po.RefundTradeEntity;
import com.simple.ds.mapper.RefundTradeMapper;
import com.simple.ds.service.RefundTradeService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * @author yasud
 * @date 2021年09月17日 22:53
 * @description
 */
@Service("RefundTradeServiceImpl2")
public class RefundTradeServiceImpl extends ServiceImpl<RefundTradeMapper, RefundTradeEntity> implements RefundTradeService {

    @Override
    public RefundTradeEntity findByParam(String k, Object value) {
        if (StringUtils.isNotBlank(k) && Objects.nonNull(value)) {
            QueryWrapper<RefundTradeEntity> queryWrapper = new QueryWrapper();
            queryWrapper.eq(k, value);
            return getOne(queryWrapper);
        }
        return null;
    }


    @Override
    public List<RefundTradeEntity> findByChannelRefundNo(String channelRefundTradeNo) {
        QueryWrapper<RefundTradeEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(RefundTradeEntity::getChannelRefundNo, channelRefundTradeNo);
        return list(queryWrapper);
    }
}
